﻿using System;

namespace Xenta.Utils
{
    /// <summary>
    /// Contains geographical helper methods.
    /// </summary>
    public static class GeoHelper
    {
        /// <summary>
        /// Builds the address string(short form).
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="addr1">The address 1.</param>
        /// <param name="addr2">The address 2.</param>
        /// <param name="city">The city.</param>
        /// <param name="region">The region.</param>
        /// <param name="country">The country.</param>
        /// <returns>The address string(short form)</returns>
        public static string AddressShortForm(string name,
            string addr1, 
            string addr2, 
            string city, 
            string region, 
            string country)
        {
            return String.Format("{0}, {1}, {2}, {3}, {4}", 
                name,
                !String.IsNullOrWhiteSpace(addr2) 
                    ? String.Format("{0}, {1}", addr1, addr2) 
                    : addr1,
                city,
                region,
                country);
        }
    }
}
